import type { RouteComponent, RouteMeta } from 'vue-router';

// 请求的路由表接口
export interface RouteRequestItem {
    id: number,
    pid: number | null,
    path: string,
    name: string,
    title: string,
    icon?: string,
    sort?: number,
    type?: number,
    roles?: Array<string>,
    keep_alive?: boolean,
    children?: Array<RouteRequestItem> | null,
    component?: any,
}
export type RouteRequestItemType<T> = {
    [K in keyof T]?: T[K] extends object ? RouteFormatItemType<T[K]> : T[K];
}
// 处理后的路由表接口
export interface RouteFormatItem {
    id: number,
    pid: number | null,
    path: string,
    flag?: boolean,
    component?: RouteComponent,
    children?: Array<RouteFormatItem> | [],
    // meta: {
    //     name: string,
    //     title: string,
    //     icon?: string,
    //     sort?: number,
    //     type?: number,
    //     roles?: Array<string>,
    //     keep_alive?: boolean,
    // }
    meta: RouteMeta
}
export type RouteFormatItemType<T> = {
    [K in keyof T]?: T[K] extends object ? RouteFormatItemType<T[K]> : T[K];
}